package com.hnx.admin.aurora.system.domain.convert.menu;

import com.hnx.admin.aurora.system.domain.dto.menu.entity.MenuDTO;
import com.hnx.admin.aurora.system.domain.vo.menu.entity.MenuVO;
import com.hnx.admin.aurora.web.json.TreeNodeVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.ReportingPolicy;

import java.util.List;

@Mapper(componentModel = "spring", unmappedSourcePolicy = ReportingPolicy.IGNORE)
public interface MenuConvert {
    List<MenuVO> toList(List<MenuDTO> list);
    @Mappings({
            @Mapping(target = "id",source = "menuId"),
            @Mapping(target = "label",source = "menuName"),
            @Mapping(target = "parentId",source = "parentId"),
            @Mapping(target = "orderNum",source = "orderNum")
    })
    TreeNodeVO toTree(MenuDTO deptDTO);
    List<TreeNodeVO> toTreeList(List<MenuDTO> list);
}
